﻿using Mad.Core.DomainServices;
using Mad.Core.Model;
using Mad.Infrastructure.ApplicationServices;
using Mad.Infrastructure.DomainServices;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mad.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            ILoggerService logger = new FileLoggerService();

            var repository = new TableRepository(new AppConfig());
            ProviderInfo provider = new ProviderInfo {Server=".", InitialCatalog="CRM_Staging", IntegratedSecurity=true };
            var ds = repository.GetDataByQuery(provider, Constants.Table.QUERY_ALL_TABLE_SCHEMA);

            List<string> items = new List<string>();
            foreach (DataRow dataRow in ds.Tables[0].Rows)
            {
                TableItem item = new TableItem(dataRow);
                items.Add(item.Item);
                System.Console.WriteLine(item.Item);
            }
            logger.LoggerInfo(items);
            logger.OpenLogger();
            System.Console.WriteLine();
            System.Console.ReadLine();
        }
    }
}
